{% extends "base.html" %}

{% block content %}
<h1>Hi, {{g.user.nickname}}!</h1>
<form>
    {{form.hidden_tag()}}
    <table>
        <tr>
            <td>Say something:</td>
            <td>{{ form.post(size=30, maxlength=140) }}</td>
            <td>
                {% for error in form.errors.post %}
                    <span style="color: red;">[{{error}}]</span><br>
                {% endfor %}
            </td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit", value="Post!"></td>
            <td></td>
        </tr>
    </table>
</form>
<!-- posts is a Paginate object -->
{% for post in posts.items %}
    {% include 'post.html' %}
{% endfor %}
{% if posts.has_prev %}
    <a href="{{ url_for('index', page = posts.prev_num) }}"><< Newer posts</a>
{% else %}
    << Newer posts
{% endif %} |
{% if posts.has_next %}
    <a href="{{ url_for('index', page = posts.next_num) }}">Older posts >></a>
{% else %}
    Older posts >>
{% endif %}
{% endblock %}